home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #21 (1994-01-12)(Diesel)(DE)[WB].zip / Purity #21 (1994-01-12)(Diesel)(DE)[WB].adf / ModToPas / txt / KonTest.mod < prev    next >
Text File  |  1993-12-13  |  2KB  |  96 lines

  1. (**********************************************************************
  2.  
  3.     :Program.    KonTest.mod
  4.     :Contents.   Testet einige TP-Module und ModToPas
  5.     :Author.     Markus Uhlendahl
  6.     :Address.    Vorm Burgtor 16, D-4408 Dülmen
  7.     :Phone.      02594/81540
  8.     :Copyright.  Public Domain
  9.     :Language.   Modula-2
  10.     :Translator. M2Amiga AMSoft V3.3d
  11.  
  12. **********************************************************************)
  13. MODULE KonTest;
  14.  
  15.  
  16. FROM TPFile    IMPORT Assign,Reset,Rewrite,Datei,WriteFReal,ReadFReal,Close,
  17.                       ReadFString,WriteFString,ReadF,WriteF,ReadFInt,WriteFInt;
  18.  
  19. FROM TPMath    IMPORT Sin,Cos,Round,Frac;
  20.  
  21. FROM TPScreen  IMPORT ClrScr,Gotoxy,DelLine,InsLine;
  22.  
  23. FROM TPSystem  IMPORT New,Dispose,MemAvail,Hi,Lo;
  24.  
  25. FROM InOut     IMPORT WriteString,WriteLn,Write,WriteInt;
  26.  
  27. FROM RealInOut IMPORT WriteReal;
  28.  
  29.  
  30. VAR r,a,b : REAL;
  31.     x,y,i : INTEGER;
  32.     f     : Datei;
  33.     s     : ARRAY[0..20] OF CHAR;
  34.     c     : CHAR;
  35.     p     : POINTER TO INTEGER;
  36.  
  37.  
  38. BEGIN
  39.   ClrScr;
  40.   r:=0.0;
  41.   WHILE (r<6.28) DO
  42.     a:=40.0+Sin (r)*40.0;
  43.     b:=14.0+Cos (r)*12.0;
  44.     x:=INTEGER(a);
  45.     y:=INTEGER(b);
  46.     Gotoxy (x,y);
  47.     WriteString ("*");
  48.     r:=r+0.05;
  49.     Gotoxy (1,1);
  50.     WriteReal (a,10,2);a:=Frac(a);WriteReal (a,10,2);
  51.   END;
  52.   Gotoxy (1,1);
  53.   FOR i:=1 TO 20 DO
  54.     DelLine;
  55.     InsLine;
  56.   END;
  57.   ClrScr;
  58.   WriteString ("Speichere Zahlen auf Datei ...");WriteLn;
  59.   Assign (f,"ram:test");
  60.   Rewrite (f);
  61.   FOR i:=1 TO 5 DO
  62.     WriteFReal (f,3.5);
  63.     WriteFString (f,"Harald");
  64.     WriteF (f,"p");
  65.     WriteFInt (f,2343);
  66.   END;
  67.   Close (f);
  68.   WriteString ("Lese Zahlen von Datei ...");WriteLn;
  69.   Assign (f,"ram:test"); (* hier Filenamen ändern *)
  70.   Reset (f);
  71.   FOR i:=1 TO 5 DO
  72.     ReadFReal (f,r);
  73.     r:=Round (r); (* Fehlerhaft ? *)
  74.     WriteReal (r,10,2);WriteLn;
  75.     ReadFString (f,s);
  76.     WriteString (s);WriteLn;
  77.     ReadF (f,c);
  78.     Write (c);WriteLn;
  79.     ReadFInt (f,x);
  80.     WriteInt (x,10);WriteLn;
  81.   END;
  82.   Close (f);
  83.   New (p);
  84.   p^:=34;
  85.   WriteInt (p^,10);WriteLn;
  86.   Dispose (p);
  87.   x:=MemAvail ();
  88.   WriteInt (x,10);WriteLn;
  89.   y:=256;
  90.   y:=Hi (y);
  91.   x:=256;
  92.   x:=Lo (x);
  93.   WriteInt (x,5);WriteLn;
  94.   WriteInt (y,5);WriteLn;
  95. END KonTest.
  96.